package com.milorad.ads;

import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;

import com.milorad.ads.pages.AdvertsOverviewPage;
import com.milorad.ads.session.UserSession;


/**
 * Application object for your web application.
 * 
 */
public class WicketApplication extends WebApplication {
	
	/**
	 * Constructor
	 */
	public WicketApplication() {
		
	}
	
	protected SpringComponentInjector getSpringInjector()
	{
		return new SpringComponentInjector(this);
	}

	@Override
	protected void init() {
		super.init();
		
		addComponentInstantiationListener(getSpringInjector());								
	}

	/* (non-Javadoc)
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	@Override
	public Class<? extends Page> getHomePage() {
		return AdvertsOverviewPage.class;
	}
	
	@Override
	public final Session newSession(Request request, Response response) {
		return new UserSession(request);
	}


}